﻿using DB.Dapper;
using Orther.Model.param;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VOL.Entity.DomainModels;

namespace Orther.Service.Miyao
{
    public class MxWeixiuService
    {
        private string mainSql = "select * from qx_mx_weixiu where 1=1 ";
        public async Task<List<qx_mx_weixiu>> GetList(MxWeixiuParam param, int? topNum)
        {
            FilterClass filterClass = this.WhereFilter(param);
            List<qx_mx_weixiu> list = await DapperUtilsForMysql.queryList<qx_mx_weixiu>(mainSql, filterClass.parameters, "CreateDate asc", filterClass.where, topNum);
            return list;
        }


        private FilterClass WhereFilter(MxWeixiuParam param)
        {
            FilterClass filterClass = new FilterClass();

            if (param.nrId != null)
            {
                filterClass.where = filterClass.where + " and nrId=@nrId ";
                filterClass.parameters.Add("@nrId", param.nrId);
            }

            return filterClass;
        }
    }
}
